package com.cq.ssm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.cq.ssm.mapper.RewardMapper;
import com.cq.ssm.mapper.RewardMapperCustom;
import com.cq.ssm.po.Reward;
import com.cq.ssm.po.RewardCustom;
import com.cq.ssm.service.RewardService;

@Component("rewardService")
public class RewardServiceImpl implements RewardService {

	@Autowired
	private RewardMapper tm;
	@Autowired
	private RewardMapperCustom tmc;
	// 插入一条记录
	public boolean insertReward(Reward title) throws Exception {
		int i = tm.insertSelective(title);
		return i==1?true:false;
	}

	// 根据id删除一条记录
	public boolean deleteById(Integer id) throws Exception {
		int i = tm.deleteByPrimaryKey(id);
		return i==1?true:false;
	}

	//根据StuffId查询
	public List<RewardCustom> findByStuffId(Integer id) throws Exception {
		return tmc.findByStuffId(id);
	}
}
